﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BF.Model;
using System.Linq.Expressions;
using BF.Infrastructure;

namespace BF.IBLL.Dictionary
{
    public interface Idic_DictBLL
    {
        /// <summary>
        /// 增加一条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        bool Add(dic_Dict model);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        bool Update();

        /// <summary>
        /// 获取字典列表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        List<dic_Dict> GetList(Expression<Func<dic_Dict, bool>> where);

        /// <summary>
        /// 获取字典列表(分页)
        /// </summary>
        /// <param name="where">条件</param>
        /// <param name="orderBy">排序字段</param>
        /// <param name="pageModel">分页实体</param>
        /// <param name="isAscending">是否升序排列</param>
        /// <returns></returns>
        List<dic_Dict> GetList(Expression<Func<Model.dic_Dict, bool>> where, Expression<Func<dic_Dict, object>> orderBy, PageModel pageModel, bool isAscending);

        /// <summary>
        /// 获取数据条数
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        int GetRowCount(Expression<Func<dic_Dict, bool>> where);

        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="gID"></param>
        /// <returns></returns>
        dic_Dict GetModel(Guid gID);

        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        dic_Dict GetModelByCondition(Expression<Func<dic_Dict, bool>> where);

        /// <summary>
        /// 获取一个实体
        /// </summary>
        /// <param name="sCode">字典编码</param>
        /// <returns></returns>
        dic_Dict GetModel(string sCode);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        bool Delete(dic_Dict model);

        /// <summary>
        /// 获取排序后的集合 Ordery By sName Desc
        /// </summary>
        /// <param name="whereLam"></param>
        /// <returns></returns>
        List<dic_Dict> GetDescList(Expression<Func<dic_Dict, bool>> whereLam);

        /// <summary>
        /// 排序
        /// </summary>
        /// <param name="gKey"></param>
        /// <param name="iSort"></param>
        /// <returns></returns>
        string Up(string gKey, int iSort, string gGENKey);
        /// <summary>
        /// 排序
        /// </summary>
        /// <param name="gKey"></param>
        /// <param name="iSort"></param>
        /// <returns></returns>
        string Down(string gKey, int iSort, string gGENKey);

        /// <summary>
        /// 排序方法对应  gKey及其排序序号
        /// </summary>
        /// <param name="gKeys"></param>
        /// <param name="iSorts"></param>
        /// <returns></returns>
        bool NewSortMethod(string[] gKeys, string[] iSorts);
    }
}
